<?php
//namespace global;

/**
 * Include path
 */
$LIBS_ROOT = 'libs';
$SRC_ROOT = 'src';

/**
 * Init Autloader
 */
require_once $LIBS_ROOT . '/DinhThi/ClassLoader/ClassLoader.php';

//Config auto load class
use DinhThi\ClassLoader\ClassLoader;

$loader = new ClassLoader();
$loader->registerLocation($LIBS_ROOT); //load all namspace on "src"
$loader->registerLocation($SRC_ROOT); //load all namspace on "libs"
//$loader->registerDefinition('BuzzInsight', $LIBS_ROOT); //for Thrift File only (because they define multi class in a file

$loader->register();

//Start to use all
////////////////////////////////////////////////////////////////////////////////
//

use DinhThi\MVC\Bootstrap;
use DinhThi\MVC\Configuration;

class MainApp {

    //main function
    public function main($args = array()) {
        date_default_timezone_set('Asia/Ho_Chi_Minh');
        $config = Configuration::getInstance();
        $config->load('config/config.ini');

        $app = new Bootstrap();
        $app->init();
    }

}

////////////////////////////////////////////////////////////////////////////////
//run main
(new MainApp)->main();
